package com.dragon.repository.domain.dto;

import com.dragon.common.util.BeanUtils;
import com.dragon.repository.entity.ToSend;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;


/**
 * @author sy
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ToSendDTO {

    private static final long serialVersionUID = 1L;

    private Integer id;

    @ApiModelProperty(value = "流程类型")
    private Integer streamType;

    @ApiModelProperty(value = "关联主表id")
    private Integer correlationId;

    @ApiModelProperty(value = "0发起抄送，1审核抄送")
    private Integer examineType;

    @ApiModelProperty(value = "抄送人")
    private Integer toAdmin;

    @ApiModelProperty(value = "抄送时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date createTime;

    @ApiModelProperty(value = "关联数据")
    private Object detail;


    public ToSendDTO() {}

    public ToSendDTO(ToSend entity) {
        BeanUtils.copyProperties(entity,this);
    }

    public static ToSendDTO convert(ToSend entity) {
        return new ToSendDTO(entity);
    }

    public static List<ToSendDTO> convertList(List<ToSend> list) {
        List<ToSendDTO> resultList = new ArrayList<>();
        for (ToSend entity : list) {
            resultList.add(new ToSendDTO(entity));
        }
        return resultList;
    }}
